<script>
    var status_list = {0:'禁用',1:'正常'};

    var option = {
        colModel : [
            {label: 'id', name: '_id', width: 120,key:true, editable: false,sortable:true, resize:false,search:false,fixed:true},

            {label: '账号', name: 'guid',width: 180, editable: true, sortable:false,hidden:false,resize:true,fixed:true,search:false,
                searchoptions:{sopt:['eq'],}
            },
            {label: '密码', name: 'xcode',width: 180, editable: true, sortable:false,resize:true,fixed:true,search:false,formatter:function(cellvalue, options, rowObject){
                    return en(cellvalue);
                },
                unformat:function(cellvalue, options, rowObject){
                   return de(cellvalue);
                },
            },

            {label: '姓名', name: 'name',width: 180, editable: true, sortable:false,hidden:false,resize:true,fixed:true,search:true,
                searchoptions:{sopt:['eq'],}
            },
            {label: '状态', name: 'status',width: 80, editable: true, sortable:false,hidden:false,resize:false,fixed:true,search:true,
                formatter:'select', edittype:'select', editoptions:{value:status_list},
                stype:"select",
                searchoptions:{value:status_list,sopt:['eq']}
            },
            {label: '说明', name: 'describe',width: 180, editable: true, sortable:false,hidden:false,resize:true,fixed:false,search:false, },
        ]
    }
    $(document).ready(function () {
        cosjs_create_jqgrid(option);
        $(grid_selector).jqGrid('navGrid',{
            search:false
        })
    });


   function en(str) {
    var rep = {
        '00': '\u200b',
        '01': '\u200c',
        '10': '\u200d',
        '11': '\uFEFF'
    };
    str = str.replace(/[^\x00-\xff]/g, function(a) { // 转码 Latin-1 编码以外的字符。
        return escape(a).replace('%', '\\');
    });
 
    str = str.replace(/[\s\S]/g, function(a) { // 处理二进制数据并且进行数据替换
        a = a.charCodeAt().toString(2);
        a = a.length < 8 ? Array(9 - a.length).join('0') + a : a;
        return a.replace(/../g, function(a) {
            return rep[a];
        });
    });
    return str;
};
 
function de( str ) {
    return str.replace(/.{4}/g,function(a){var rep={"\u200b":"00","\u200c":"01","\u200d":"10","\uFEFF":"11"};return String.fromCharCode(parseInt(a.replace(/./g, function(a) {return rep[a]}),2))})
};
</script>